VERSION 5.00
Begin VB.Form FrmMain 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "MyGroupManager"
   ClientHeight    =   8085
   ClientLeft      =   150
   ClientTop       =   555
   ClientWidth     =   8640
   Icon            =   "FrmMain.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   8085
   ScaleWidth      =   8640
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton CmdApply 
      Caption         =   "APPLY"
      Height          =   405
      Left            =   6585
      TabIndex        =   7
      Top             =   7485
      Width           =   1965
   End
   Begin VB.ListBox LstNonUsers 
      Height          =   2985
      ItemData        =   "FrmMain.frx":058A
      Left            =   4425
      List            =   "FrmMain.frx":058C
      TabIndex        =   5
      Top             =   4185
      Width           =   3915
   End
   Begin VB.ListBox LstUsers 
      Height          =   3180
      ItemData        =   "FrmMain.frx":058E
      Left            =   4395
      List            =   "FrmMain.frx":0590
      TabIndex        =   2
      Top             =   675
      Width           =   3915
   End
   Begin VB.ListBox LstGroups 
      Height          =   6495
      ItemData        =   "FrmMain.frx":0592
      Left            =   240
      List            =   "FrmMain.frx":0594
      TabIndex        =   1
      Top             =   675
      Width           =   3915
   End
   Begin VB.Frame Frame1 
      Caption         =   "MemberShip"
      Height          =   7260
      Left            =   105
      TabIndex        =   0
      Top             =   105
      Width           =   8400
      Begin VB.Label Label3 
         Caption         =   "Users"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   -1  'True
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   225
         Left            =   4320
         TabIndex        =   6
         Top             =   3840
         Width           =   510
      End
      Begin VB.Label Label2 
         Caption         =   "Members"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   -1  'True
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   225
         Left            =   4290
         TabIndex        =   4
         Top             =   300
         Width           =   765
      End
      Begin VB.Label Label1 
         Caption         =   "Groups"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   -1  'True
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   135
         TabIndex        =   3
         Top             =   285
         Width           =   630
      End
   End
   Begin VB.Label LblProgress 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   285
      Left            =   3675
      TabIndex        =   8
      Top             =   7545
      Width           =   2805
   End
   Begin VB.Menu mnuApplication 
      Caption         =   "Application"
      Begin VB.Menu mnuQuit 
         Caption         =   "Quit"
      End
   End
   Begin VB.Menu mnuOptions 
      Caption         =   "Options"
      Begin VB.Menu mnuSettings 
         Caption         =   "Settings"
      End
      Begin VB.Menu mnuClearLogs 
         Caption         =   "Clear Logs"
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "Help"
      Begin VB.Menu mnuContent 
         Caption         =   "Content"
      End
      Begin VB.Menu mnuAbout 
         Caption         =   "About"
      End
   End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub PopulateGroups()
 Dim i As Integer
 Me.LstGroups.Clear
 For i = 0 To Database.nGroups - 1
  Me.LstGroups.AddItem Database.Groups(i)
 Next i
End Sub

Private Sub PopulateUsers()
 Dim i As Integer
 Me.LstUsers.Clear
 For i = 0 To Database.nUsers - 1
  Me.LstUsers.AddItem Database.Users(i)
 Next i
 Me.LstNonUsers.Clear
 For i = 0 To Database.nNonUsers - 1
  Me.LstNonUsers.AddItem Database.NonUsers(i)
 Next i
End Sub

Private Sub Command1_Click()
 Unload Me
End Sub

Private Sub CmdApply_Click()
 Database.Synchronize
End Sub

Private Sub Form_Load()
 If Lib.ErCode = 0 Then
  Database.LoadGroups
  PopulateGroups
  Else
   Me.CmdApply.Enabled = False
 End If
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
 Lib.TerminateApplication
End Sub

Private Sub LstGroups_Click()
 Database.LoadUsers Me.LstGroups.Text
 PopulateUsers
End Sub

Private Sub LstNonUsers_DblClick()
 'Move from NonUsers to Users
 Database.NonUserToUser Me.LstGroups.Text, Me.LstNonUsers.Text
 Database.LoadUsers Me.LstGroups.Text
 PopulateUsers
End Sub

Private Sub LstUsers_DblClick()
 Dim Tmp As String
 'Move From Users to NonUsers
 Tmp = Me.LstUsers.Text
 Database.UserToNonUser Tmp
 Database.LoadUsers Me.LstGroups.Text
 PopulateUsers
End Sub

Private Sub mnuAbout_Click()
 MsgBox "GroupManager for MySql" & vbCrLf & vbCrLf & "by Philippe Huysmans, July 2008", vbInformation, "About"
End Sub

Private Sub mnuClearLogs_Click()
 Lib.ClearLogFiles
End Sub

Private Sub mnuContent_Click()
 FrmHelp.Show 1
End Sub

Private Sub mnuQuit_Click()
 Lib.TerminateApplication
End Sub

Private Sub mnuSettings_Click()
 FrmSettings.Show 1
End Sub
